package com.feiyu.stackqueue;

import java.util.List;

/**
 * @Author nanshouxiao@teacher.com.cn
 * @Date 2017-10-27 15:46
 */
public abstract class BaseStackQueue<T> {
    protected Object[] datas;
    protected int maxSize;
    protected int top;

    protected BaseStackQueue() {
        this(10);
    }

    protected BaseStackQueue(int capacity) {
        maxSize = capacity;
        datas = new Object[maxSize];
        top = -1;
    }

    public abstract T pop();

    public abstract T peek();

    public abstract T push(T t);


    public int capacity() {
        return maxSize;
    }

    public int size() {
        return top + 1;
    }

    public boolean isEmpty() {
        return top == -1;
    }

    public boolean isFull() {
        return top >= maxSize - 1;
    }
}
